package com.karst.essentials.chapter03
{
	import flash.display.Sprite;
	
	public class Chapter03View extends Sprite
	{
		public static const SECTION_LIST : Array = 
			["平面-PlanExample", "球体-SphereExample", "圆柱-CylinderExample",
			 "圆锥体-ConeExample", "立方体-CubeExample", "纸飞机-PaperPlaneExample",
			 "箭头-ArrowExample", "嵌套-NestingExample", "DisplayObject3D-Do3dExample",
			 "球体组成的球体-VerticesExample"] ;
		
		public function Chapter03View()
		{
			super();
		}
		
		
		public function showSection( $section : String = "" ) : void
		{
			while( numChildren )
				removeChildAt( 0 ) ;
			switch( $section )
			{
				case SECTION_LIST[0] :
					createPlanExample() ;
					break ;
				case SECTION_LIST[1] :
					createSphereExample() ;
					break ;
				case SECTION_LIST[2] :
					createCylinderExample() ;
					break ;
				case SECTION_LIST[3] :
					createConeExample() ;
					break ;
				case SECTION_LIST[4] :
					createCubeExample() ;
					break ;
				case SECTION_LIST[5] :
					createPaperPlaneExample() ;
					break ;
				case SECTION_LIST[6] :
					createArrowExample() ;
					break ;
				case SECTION_LIST[7] :
					createNestingExample() ;
					break ;
				case SECTION_LIST[8] :
					createDo3dExample() ;
					break ;
				case SECTION_LIST[9] :
					createVerticesExample() ;
					break ;
				default :
					break ;
			}
		}

		private var planExample : PlanExample = null ;
		private function createPlanExample() : void
		{
			if( planExample == null )
				planExample = new PlanExample() ;
			addChild( planExample ) ;
		}

		private var sphereExample : SphereExample = null ;
		private function createSphereExample() : void
		{
			if( sphereExample == null )
				sphereExample = new SphereExample() ;
			addChild( sphereExample ) ;
		}

		private var cylinderExample : CylinderExample = null ;
		private function createCylinderExample() : void
		{
			if( cylinderExample == null )
				cylinderExample = new CylinderExample() ;
			addChild( cylinderExample ) ;
		}

		private var coneExample : ConeExample = null ;
		private function createConeExample() : void
		{
			if( coneExample == null )
				coneExample = new ConeExample() ;
			addChild( coneExample ) ;
		}

		private var cubeExample : CubeExample = null ;
		private function createCubeExample() : void
		{
			if( cubeExample == null )
				cubeExample = new CubeExample() ;
			addChild( cubeExample ) ;
		}

		private var paperPlaneExample : PaperPlaneExample = null ;
		private function createPaperPlaneExample() : void
		{
			if( paperPlaneExample == null )
				paperPlaneExample = new PaperPlaneExample() ;
			addChild( paperPlaneExample ) ;
		}

		private var arrowExample : ArrowExample = null ;
		private function createArrowExample() : void
		{
			if( arrowExample == null )
				arrowExample = new ArrowExample() ;
			addChild( arrowExample ) ;
		}

		private var nestingExample : NestingExample = null ;
		private function createNestingExample() : void
		{
			if( nestingExample == null )
				nestingExample = new NestingExample() ;
			addChild( nestingExample ) ;
		}

		private var do3dExample : Do3dExample = null ;
		private function createDo3dExample() : void
		{
			if( do3dExample == null )
				do3dExample = new Do3dExample() ;
			addChild( do3dExample ) ;
		}

		private var verticesExample : VerticesExample = null ;
		private function createVerticesExample() : void
		{
			if( verticesExample == null )
				verticesExample = new VerticesExample() ;
			addChild( verticesExample ) ;
		}
	}
}